<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta name="keywords" content=""/>
    <meta name="description" content="">
    <include file="public@head_base"/>
    <link rel="stylesheet" href="__TMPL__/public/assets/css/volunteer.css">

</head>

<body class="body-white">
<div class="container shadow">
    <include file="public@nav_base"/>
    <div class="row">
        <div class="upload_form">
            <img src="__TMPL__/public/assets/images/ok.png" style="margin: auto;display: block;margin-top: 48px;">
            <h2 class="text-center" style="margin-top: 16px;color: #2faa53">申请成功</h2>
            <p class="tips"></p>
        </div>
    </div>
</div>
<!-- /container -->

<include file="public@scripts"/>
</body>
<script>
    //Demo
    layui.use(['form', 'laydate', 'upload'], function () {
        var form = layui.form;
        var layer = layui.layer;
        //监听提交
        form.on('submit(formDemo)', function (data) {

            var index = layer.load(2);
            console.log(data);
            var fields=$(data.form).serialize();
            $.post("{:url('volunteer/register/doRegister')}", fields, function (res) {
                console.log(res);
                layer.close(index);
                layer.alert(res.msg, function (index) {
                    if (res.code == 1) {
                        window.location.href = res.url;
                    }
                    layer.close(index)
                });

            });
            return false;
        });
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#date' //指定元素
        });
        var upload = layui.upload;
        upload.render({
            elem: '#avatar'
            , url: "{:url('volunteer/register/photo')}"
            , done: function (res, index, upload) { //上传后的回调
                console.log(res);
                var img = $(".photo");
                console.log(img);
                img.attr('src', res.url);
                $("#photo").val(res.data.file);
            }
            //,accept: 'file' //允许上传的文件类型
            //,size: 50 //最大允许上传的文件大小
            //,……
        })
    });

</script>
</html>